"use strict";
const Criteria = require("./criteria");
/**
 * sql工具
 */
class Example {
  constructor() {
    this.orders = [];
    this.columns = [];
    this.pageInfo = { pageIndex: 1, pageSize: 500 };
    this.criteria = new Criteria();
  }

  /**
   * 设置排序
   * @param {string} field 
   * @param {*} sort 
   */
  setOrder(field, sort) {
    this.orders.push(field + " " + sort);
  }

  /**
   * 设置返回字段
   * @param {[]} columns 
   */
  setColumns(columns) {
    this.columns = columns;
  }

  /**
   * 设置分页
   * @param {number} page 
   * @param {number} size 
   */
  setPage(page = 1, size = 10) {
    this.pageInfo = { pageIndex: page, pageSize: size };
  }
}
module.exports = Example;